package cn.wolfcode.web.interceptor;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.util.UserContext;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class LoginInterceptor implements HandlerInterceptor {

   /* public boolean preHandle (HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
        //从sessinon中获取当前登录对象
        Employee employee = UserContext.getCurrentUser();
        //判断是否为空,true代表没有登录,false代表有登录
        if (employee == null) {
            //跳转到登录页面
            response.sendRedirect("/login.html");
            return false;//不放行
        }

        return true;
    }*/
}
